FAT32 FileSystem Library
This is FAT32 FileSystem Library, which is #![no_std]
and does not use alloc
.
Test passed with sdio_sdhc and WindowsAPI.
Supported Features
- Read
- Create File AND Dir
- Write(OverWritten and Append)
- Delete File AND DIR
Questions
My Device Support std
, Can I Use This Crate?
Of course you can, but I don't recommend it. You should use std::fs::File
OR other crates.
Why Do You Write This Crate?
In order to support devices and environment which don't have std
, like
- Embedded Device
- Bootloader
Have More Examples?
How To Test (Only Windows)
- EDIT mount() function in lib.rs, change disk like
\\\\.\\E:
cargo test
How To Use
You need make your library implement BlockDevice
trait:
For example, I use my another library sdio_sdhc to implement:
Now sdio_sdhc library supported fat32 filesystem. Then, add fat32 library to your application
# if no feature config, the BUFFER_SIZE is 512 Bytes
fat32 = "0.2"
If your card block is other size, like 1024 Bytes
[dependencies.fat32]
version = "0.2"
default-features = false
features = ["1024"]
Then, you can do some tests
// Card from sdio_sdhc crate
let card = init.unwrap;
// Volume from fat32 crate
let cont = new;
// cd root dir
let root = cont.root_dir;
// create file named test.txt
root.create_file.unwrap;
// open file
let mut file = root.open_file.unwrap;
// write buffer to file
file.write.unwrap;
If all goes well, the file was created with 1234 Bytes in root dir.